<div id="profile">
	
	<h1 class="show_title">Profile</h1>
	
	<div id="slika">
		<%= image_tag(@profile.getPicturePath, :size => "120x120", :id => "picture") %>
	</div>
	
	<div id="vmesni_del">
		<p id="username"><%=h @profile.user.username %></p>
		<p id="member_since">Member since: <%= @profile.created_at.strftime("%d %B %Y") %></p>
	</div>
	
	<div id="ikone">
		<% email = User.find(:first, :conditions => {:username => @profile.user.username}).email %>
		<p id="email"><img src="/images/email.png" alt="email" /><a class="link" href="mailto:<%= email %>"><%= email %></a> (<%= @profile.email == true ? "public"  : "private" %>)</p>
		<% if (!@profile.webpage.nil? && @profile.webpage.length > 0) %>
			<p id="webpage"><img src="/images/webpage.png" alt="webpage" /><a class="link" href="http://<%=h @profile.webpage %>"><%=h @profile.webpage %></a></p>
		<% end %>
		<% if (!@profile.company.nil? && @profile.company.length > 0) %>
			<p id="company"><img src="/images/company.png" alt="company" /><%=h @profile.company %></p>
		<% end %>
		<% if (!@profile.IM.nil? && @profile.IM.length > 0) %>
			<p id="im"><img src="/images/im.png" alt="im" /><%=h @profile.IM %></p>
		<% end %>
	</div>
	
	<div id="uredi">
		<%= link_to 'Edit', edit_profile_path(@profile), :class => "default_button_class" %><br />
	</div>
	
	<div style="clear: both"></div>
	
	<% if (!@profile.portfolio.nil? && @profile.portfolio.length > 0) %>
		<div id="portfolio">
			<b>Portfolio:</b>
			<p>
				<%=h @profile.portfolio %>
			</p>
		</div>
	<% end %>
	
	<% if @codes.count > 0 then %>
	
		<br /><br />
		<h3>My codes</h3>
		<table style="width: 100%">
			<tr>
				<td>
					<tr class="legend_tr">
						<td style="width: 70%"><a class="legend_a">Title</a>/<a class="legend_a">Author</a></td>
						<td class="legend_td" style="width: 10%"><a class="legend_a">Views</a></td>
						<td class="legend_td" style="width: 10%"><a class="legend_a">Comments</a></td>
						<td class="legend_td" style="width: 10%"><a class="legend_a">Ratio</a></td>		
					</tr>
					<% @codes.each do |code| %>
					<table class="codes_table">
		  				<tr>
							<td style="width: 70%">
								<%= link_to code.title, code %> 
								by 
								<%= link_to code.getAuthorName, user_path(code.getAuthorName) %>
								<br />
								<p><%=h code.shortdescription %></p>
								<p class="codes_table_p">
									<%= link_to code.getProgLangName, code.getProgLang, :class => "codes_table_a" %>
									/
									<%= link_to code.getCategoryName, code.getCategory, :class => "codes_table_a" %>
								</p>
							</td>
							<td class="codes_table_td" style="width: 10%;"> <%= code.views %> </td>
		  					<td class="codes_table_td" style="width: 10%;"> <%= code.getNumComments %></td>
		   				 	<td class="codes_table_td" style="width: 10%;"> <%= code.getSumGrades %>    </td>	
		  				</tr>
					<% end %>
					</table>
				</td>
			</tr>
		</table>
		<br />
		
		Page: 
		<% i = 1; while i <= @numPages %>
		   <%= link_to i, {:controller => 'codes', :action => 'index', :page => i, :lang => params[:lang], :cat => params[:cat]}, :post => true, :class => "default_button_class default_button_class_selected" %>
		   <%  i += 1 %>
		<%  end %>
	
	<% end %>
	
</div>